package com.git_taoxian.test2;

import com.git_taoxian.test1.ShowHandIer;

public class StringHandlerDemo {
    public static void main(String[] args) {

 //       多态 获取当前接口的子类对象
//        StringHandler stringHandler = new StringHandler() {
//            @Override
//            public void printMessage(String str) {
////                打印当前的字符串
//                System.out.println(str);
//            }
//        };
        //        Lambda表达式
        StringHandler stringHandler = str -> System.out.println(str);
//        生成当前测试类的对象
        StringHandlerDemo stringHandlerDemo = new StringHandlerDemo();
        stringHandlerDemo.useStringHandler(stringHandler,"hello");
    }
//    useStringHandler方法
    public static void useStringHandler(StringHandler stringHandler,String str){
        stringHandler.printMessage(str);
    }

}
